﻿package {
	import flash.display.Sprite;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.geom.Rectangle;
	import mvc.PainterFacade;
	
	public class Main extends Sprite {
		
		public var canvas:Canvas;
		
		public function Main():void {
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event = null):void {
			removeEventListener(Event.ADDED_TO_STAGE, init);
			
			stage.scaleMode = StageScaleMode.NO_SCALE;
			root.scrollRect = new Rectangle(0, 0, 640, 400);
			
			canvas = new Canvas();
			addChildAt(canvas, 1);
			
			PainterFacade.getInstance("painter").startup(this);
		}
	}
}